/* ===================================================================
   app.css — Estilos principales de TrackerSAT v1.3
   Extraído de index.php para separación de responsabilidades (SRP).
   =================================================================== */

/* --- VARIABLES CSS --- */
:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    --accent: #3b82f6;
}

/* --- RESET Y BASE --- */
body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- DASHBOARD LAYOUT --- */
#app-header {
    height: 70px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title svg {
    color: var(--accent);
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

#logout-btn {
    background: rgba(141, 21, 61, 0.6);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.status-badge {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

#app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* --- SIDEBAR --- */
#sidebar {
    width: 380px;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    flex-direction: column;
    /* Asegura que los hijos se apilen */
    height: 100%;
    /* Ocupa todo el alto */
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}

#worker-list-container {
    flex: 1;
    /* Esto obliga a la lista a ocupar todo el espacio restante */
    overflow-y: auto;
    /* Permite scroll si hay muchos trabajadores */
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-title {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 12px;
}

/* --- SYNC BUTTON --- */
.sync-btn {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sync-btn:hover {
    background: rgba(59, 130, 246, 0.4);
    border-color: rgba(59, 130, 246, 0.8);
    transform: scale(1.05);
}

.sync-btn:active {
    transform: scale(0.95);
}

@keyframes spin {
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

.syncing svg {
    animation: spin 1s linear infinite;
}

/* --- WORKER LIST --- */
.worker-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.worker-list::-webkit-scrollbar {
    width: 6px;
}

.worker-list::-webkit-scrollbar-track {
    background: transparent;
}

.worker-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.worker-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- WORKER CARDS --- */
.worker-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    height: auto;
    min-height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.usuario-input,
.password-input {
    padding: 10px;
    background-color: white;
    color: #000;
    border-radius: 10px;
    gap: 10px;
    margin-bottom: 10px;

}

.worker-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.worker-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent);
    border-radius: 4px 0 0 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.worker-card:hover::before {
    opacity: 1;
}

.worker-card.offline::before {
    background: #ef4444;
}

.worker-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.worker-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #1e3a8a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.worker-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.worker-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f8fafc;
    margin: 0 0 4px 0;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.worker-role {
    font-size: 0.75rem;
    color: #cbd5e1;
    margin: 0;
}

.worker-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    gap: 8px;
}

.worker-location {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    flex: 1;
    line-height: 1.3;
}

.worker-meta span {
    flex-shrink: 0;
    white-space: nowrap;
}

/* --- STATUS DOT --- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
    flex-shrink: 0;
}

.status-dot.offline {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

/* --- MAP CONTAINER --- */
#map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* --- PULSE ANIMATION --- */
.pulse-dot {
    width: 10px;
    height: 10px;
    background-color: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(52, 211, 153, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
}

@keyframes slideDown {
    from {
        top: -50px;
        opacity: 0;
    }

    to {
        top: 24px;
        opacity: 1;
    }
}

/* --- LEAFLET CONTROLS OVERRIDE --- */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--glass-shadow) !important;
    border-radius: 12px !important;
    overflow: hidden;
    margin-bottom: 24px !important;
    margin-right: 24px !important;
}

.leaflet-control-zoom a {
    background-color: var(--glass-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--glass-border) !important;
    backdrop-filter: blur(8px) !important;
    transition: all 0.3s ease !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
}

.leaflet-control-zoom a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--accent) !important;
}

.leaflet-control-attribution {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(4px) !important;
    color: #94a3b8 !important;
    border-radius: 8px 0 0 0;
    padding: 4px 8px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: #60a5fa !important;
    text-decoration: none;
}

.leaflet-control-attribution a:hover {
    text-decoration: underline;
}

.leaflet-popup-content {
    word-wrap: break-word !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    margin: 14px 16px !important;
}

/* Dark mode filter for OSM tiles */
.leaflet-layer.dark-osm {
    filter: grayscale(100%) invert(100%) brightness(95%) contrast(120%);
}

/* --- LEGEND --- */
.info.legend {
    margin-bottom: 24px !important;
    margin-right: 24px !important;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.theme-toggle-btn {
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    outline: none;
    padding: 0;
    z-index: 10;
}

.theme-toggle-btn:hover {
    transform: scale(1.05);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.theme-toggle-btn svg {
    width: 24px;
    height: 24px;
}

.legend-btn-inner,
.legend-btn-outer {
    transition: transform 0.35s ease-in-out;
    transform-origin: 120px 120px;
}

.info.legend:not(.collapsed) .legend-btn-inner {
    transform: rotate(-180deg);
}

.info.legend:not(.collapsed) .legend-btn-outer {
    transform: rotate(180deg);
}

.legend-panel {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    color: var(--text-color);
    min-width: 170px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: bottom right;
    opacity: 1;
    transform: scale(1);
}

.legend-title {
    margin: 0 0 12px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #f8fafc;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.info.legend.collapsed .legend-panel {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    position: absolute;
    bottom: 60px;
    right: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
}

.info.legend:not(.collapsed) .legend-panel {
    visibility: visible;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0s;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.legend-item.inactive {
    opacity: 0.4;
    filter: grayscale(100%);
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

/* --- NO-ADDRESS CARDS (RED) --- */
.worker-card.no-address {
    border: 1px solid rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.08);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.15), inset 0 0 0 1px rgba(239, 68, 68, 0.1);
}

.worker-card.no-address::before {
    background: #ef4444;
    opacity: 1;
}

.worker-card.no-address:hover {
    border-color: rgba(239, 68, 68, 0.7);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.25), 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.worker-card.no-address .no-address-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

/* --- HEADER: NO-ADDRESS ALERT --- */
.no-addr-alert {
    position: relative;
    display: none;
}

.no-addr-alert.visible {
    display: flex;
}

.no-addr-btn {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.70rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.no-addr-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.6);
}

.no-addr-count {
    background: #ef4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

.no-addr-chevron {
    transition: transform 0.25s ease;
}

.no-addr-alert.open .no-addr-chevron {
    transform: rotate(180deg);
}

.no-addr-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 12px;
    padding: 0;
    min-width: 320px;
    max-height: 350px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 2000;
    overflow: hidden;
}

.no-addr-alert.open .no-addr-dropdown {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.no-addr-dropdown-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
    font-weight: 600;
    color: #f87171;
    display: flex;
    align-items: center;
    gap: 8px;
}

.no-addr-dropdown-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 6px 0;
}

.no-addr-dropdown-list::-webkit-scrollbar {
    width: 5px;
}

.no-addr-dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}

.no-addr-dropdown-list::-webkit-scrollbar-thumb {
    background: rgba(239, 68, 68, 0.3);
    border-radius: 10px;
}

.no-addr-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.no-addr-item:hover {
    background: rgba(239, 68, 68, 0.08);
}

.no-addr-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.no-addr-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-addr-item-list {
    font-size: 0.7rem;
    color: #64748b;
    flex-shrink: 0;
}

/* ── FILTRO DE TÉCNICOS (header, multi-checkbox) ── */
.tecnico-filter-wrap {
    position: relative;
}

.tecnico-filter-btn {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.tecnico-filter-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.6);
}

.tecnico-chevron {
    transition: transform 0.25s ease;
}

.tecnico-filter-wrap.open .tecnico-chevron {
    transform: rotate(180deg);
}

.tecnico-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 2000;
}

.tecnico-filter-wrap.open .tecnico-dropdown {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.tecnico-dropdown-header {
    padding: 8px 16px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tecnico-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

.tecnico-option:hover {
    background: rgba(59, 130, 246, 0.08);
}

.tecnico-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── LEYENDA EN EL HEADER ── */

.legend-wrap.open .legend-header-chevron {
    transform: rotate(180deg);
}

.legend-header-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 2000;
}

.legend-wrap.open .legend-header-dropdown {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.legend-header-dropdown-title {
    padding: 8px 16px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legend-header-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: opacity 0.2s ease, filter 0.2s ease, background 0.15s ease;
    user-select: none;
}

.legend-header-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.legend-header-item.inactive {
    opacity: 0.35;
    filter: grayscale(100%);
}

.legend-header-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

/* ── LEYENDA FIJA EN EL HEADER ── */
.header-legend {
    position: static !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    padding: 0 10px;
    height: 38px;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.70rem;
    font-weight: 500;
    color: #cbd5e1;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
    white-space: nowrap;
    user-select: none;
}

.header-legend-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #f8fafc;
}

.header-legend-item.inactive {
    opacity: 0.35;
    filter: grayscale(100%);
}

.header-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.header-legend-separator {
    width: 1px;
    height: 16px;
    background: var(--glass-border);
    flex-shrink: 0;
}

/* --- BOTÓN CALENDARIO --- */
.calendar-btn {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid var(--accent);
    color: white;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.calendar-btn:hover {
    background: var(--accent);
}

.calendar-btn:active {
    transform: translateY(0);
}

.calendar-btn svg {
    color: var(--accent);
}

/* Corrección para que la lista siempre sea visible */
#sidebar {
    display: flex;
    flex-direction: column;
}

.worker-list {
    flex: 1;
    overflow-y: auto;
}

/* --- ESTILOS DEL MODAL CALENDARIO --- */
#calendar-modal {
    display: none;
    /* Oculto por defecto */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.calendar-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--glass-shadow);
    color: white;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: capitalize;
}

.close-calendar {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
}

.day-name {
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.8rem;
    padding-bottom: 10px;
}

.calendar-day {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.calendar-day.today {
    background: var(--accent);
    color: white;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.calendar-day.has-task {
    border-color: #ef4444;
    color: #f87171;
}

.calendar-day:hover:not(.empty) {
    background: rgba(255, 255, 255, 0.1);
    cursor: default;
}

.empty {
    background: transparent;
}

/* --- MODAL CALENDARIO --- */
#calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    /* Fondo oscuro traslúcido */
    backdrop-filter: blur(5px);
    display: none;
    /* Se cambia a flex con JS */
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* Por encima de todo */
}

.calendar-content {
    background: #1e293b;
    /* Color oscuro como el resto de la app */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.calendar-header-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header-ui h2 {
    margin: 0;
    color: #3b82f6;
    /* Azul accent */
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 2rem;
    cursor: pointer;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.day-name {
    color: #64748b;
    font-weight: bold;
    font-size: 0.8rem;
    text-align: center;
    padding-bottom: 5px;
}

.calendar-day {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: #f8fafc;
    font-size: 0.9rem;
}

.calendar-day.today {
    background: #3b82f6;
    color: white;
    font-weight: bold;
}

.calendar-day.empty {
    background: transparent;
}

/* Día que tiene mantenimientos */
.calendar-day.has-tasks {
    border: 1.5px solid #3b82f6;
    /* Borde azul */
    cursor: help;
    background: rgba(59, 130, 246, 0.15);
}

.calendar-day.has-tasks:hover {
    background: #3b82f6;
    color: white;
}

/* Lista dentro del tooltip */
.tooltip-task-item {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-task-item:last-child {
    border-bottom: none;
}

.tooltip-task-name {
    font-weight: bold;
    display: block;
    color: #60a5fa;
}

.tooltip-task-tech {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Ajustes para el calendario dentro del sidebar */
#sidebar-calendar {
    flex-direction: column;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    /* Menos espacio para que quepa en el sidebar */
}

.calendar-day {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #cbd5e1;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.calendar-day.has-tasks {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    font-weight: bold;
    cursor: pointer;
}

.calendar-day.today {
    background: var(--accent);
    color: white;
}

.day-name {
    text-align: center;
    font-size: 0.7rem;
    color: #64748b;
    font-weight: bold;
    text-transform: uppercase;
}

/* Tooltip ajustado para no salirse */
#calendar-tooltip {
    max-width: 250px;
    word-wrap: break-word;
}

.sync-btn {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: white;
    border-radius: 8px;
    /* Cambiado a 8px para que haga juego con el buscador */
    cursor: pointer;
    transition: all 0.2s ease;
}

.sync-btn:hover {
    background: rgba(59, 130, 246, 0.4);
    border-color: var(--accent);
}

/* Animación de rotación cuando se pulsa (clase syncing se añade por JS) */
@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.syncing svg {
    animation: spin 1s linear infinite;
}

.nav-btn-cal {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--accent);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.nav-btn-cal:hover {
    background: var(--accent);
    color: white;
}

#etiqueta-dropdown {
    max-height: 300px;
    overflow-y: auto;
    min-width: 250px;
}

#etiqueta-opciones {
    max-height: 250px;
    overflow-y: auto;
}